package com.candy.control;


import com.candy.service.UserInfoService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/saveUserInfo")
public class AddUserInfoServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//       接收前端传递进来的参数
        String username=req.getParameter("username");
        String userpwd=req.getParameter("userpwd");
        String useraddress=req.getParameter("useraddress");
        String usertel=req.getParameter("usertel");
//        调用业务逻辑处理层
        UserInfoService service=new UserInfoService();
        service.addUserInfo(username,userpwd,useraddress,usertel);
        req.getRequestDispatcher("/getUserInfoes").forward(req,resp);

    }
}
